<template>
	<view style="height: 100%">
		<!-- pages/userCenter/userCenter.wxml -->
		<view class="container">
			<!-- 头部 -->
			<view class="pageHeader"></view>
			<view class="top">

				<view>
					<button class="getUserInfoBtn" @tap="getUserProfileInfo">
						<image class="user-pic"
							:src="userInfo.Fheadimgurl == null ? '/static/file/images/user_pic.png' : userInfo.Fheadimgurl">
						</image>
					</button>
				</view>

			</view>
			<!-- 余额/积分/可结佣金 -->
			<!--   <view class="amount_bar around v-center">
                <view class="item">
                    <view class="num">￥{{ userInfo.Fbalance ? userInfo.Fbalance : '0.00' }}</view>
                    <view class="type">余额</view>
                </view>
                <view class="item">
                    <view class="num">-</view>
                    <view class="type">积分</view>
                </view>
                <view class="item" @tap="linkPage" data-url="/pages/myCoupon/myCoupon">
                    <view class="num">{{ null == mebInfo.Fcouponnum ? 0 : mebInfo.Fcouponnum }}</view>
                    <view class="type">优惠券</view>
                </view>
            </view> -->
			<!-- 订单 -->
			<view class="orderType">
				<view class="header v-center between">
					<view class="left-text">我的订单</view>
					<view @tap="linkPage" data-url="/pages/orders/orders?type=0" class="right-text v-center vh-center">
						全部订单
						<image style="width: 32px; height: 32px" src="/static/file/images/new_right.png"></image>
					</view>
				</view>
				<view class="typeList v-center around">
					<view @tap="linkPage" data-url="/pages/orders/orders?type=1" class="item">
						<view :style="'color:' + color" class="icon iconfont icon-fukuanfangshisel"></view>
						<view class="typeName">待付款</view>
						<view v-if="mebInfo.Fprepaynum != '0'" class="num_icon">{{ mebInfo.Fprepaynum }}</view>
					</view>

					<view @tap="linkPage" data-url="/pages/orders/orders?type=2" class="item">
						<view :style="'color:' + color" class="icon iconfont icon-daifahuo"></view>
						<view class="typeName">待发货</view>
						<view v-if="mebInfo.Fsendnum != '0'" class="num_icon">{{ mebInfo.Fsendnum }}</view>
					</view>
					<view @tap="linkPage" data-url="/pages/orders/orders?type=3" class="item">
						<view :style="'color:' + color" class="icon iconfont icon-daishouhuo"></view>
						<view class="typeName">待收货</view>
						<view v-if="mebInfo.Fconfignum != '0'" class="num_icon">{{ mebInfo.Fconfignum }}</view>
					</view>
					<view @tap="linkPage" data-url="/pages/orders/orders?type=4" class="item">
						<view :style="'color:' + color" class="icon iconfont icon-yiwancheng"></view>
						<view class="typeName">已完成</view>
					</view>
				</view>
			</view>
			<!-- 佣金 -->
			<!-- <view v-if="Fmodel == 1 || (Fstatus == 1 && Fmodel == 2 && userInfo.Froletype == 1)" class="distribution">
                <view class="header v-center between">
                    <view class="left-text">分销佣金</view>
                    <view @tap="linkPage" data-url="/pages/brokerage/brokerage?type=1" class="right-text v-center vh-center">
                        提现
                        <image style="width: 32px; height: 32px" src="/static/file/images/new_right.png"></image>
                    </view>
                </view>
                <view class="dtypeList v-center around">
                    <view @tap="linkPage" data-url="/pages/brokerage/brokerage?type=1" class="item">
                        <view class="distribution_num">￥{{ Ffx.Frate1 }}</view>
                        <view class="typeName">一级佣金</view>
                    </view>

                    <view @tap="linkPage" data-url="/pages/brokerage/brokerage?type=2" class="item">
                        <view class="distribution_num">￥{{ Ffx.Frate2 }}</view>
                        <view class="typeName">二级佣金</view>
                    </view>
                    <view @tap="linkPage" data-url="/pages/myMember/myMember?type=1" class="item">
                        <view class="distribution_num">{{ null == Ffx.Fmember1 ? 0 : Ffx.Fmember1 }}</view>
                        <view class="typeName">一级促销员</view>
                    </view>
                    <view @tap="linkPage" data-url="/pages/myMember/myMember?type=2" class="item">
                        <view class="distribution_num">{{ null == Ffx.Fmember2 ? 0 : Ffx.Fmember2 }}</view>
                        <view class="typeName">二级促销员</view>
                    </view>
                </view>
            </view> -->
			<!-- 更多服务 -->
			<view class="moreContent">
				<view class="header v-center between">
					<view class="left-text">更多服务</view>
				</view>
				<view class="moreList wrap">
					<!--      <view @tap="linkPage" data-url="/pages/myPinTuan/myPinTuan" class="item">
                        <view :style="'color:' + color1" class="icon iconfont icon-wodepintuan"></view>
                        <view class="typeName">我的拼团</view>
                    </view>
                    <view @tap="linkPage" data-url="/pages/myGroup/groupOrder" class="item">
                        <view :style="'color:' + color1" class="icon iconfont icon-daichengtuan"></view>
                        <view class="typeName">我的团购</view>
                    </view> -->
					<view @tap="linkPage" data-url="/pages/myAddress/myAddress?type=0" class="item">
						<view :style="'color:' + color1" class="icon iconfont icon-shouhuodizhi"></view>
						<view class="typeName">收货地址</view>
					</view>
					<!--  <view @tap="doshare" class="item">
                        <view :style="'color:' + color" class="icon iconfont icon-fenxiang"></view>
                        <view class="typeName" :style="'color:' + color">分享有礼</view> -->
					<!-- <view class="item">
        <button hover-class="none" open-type="share">
          <view style="height: 39px; color:{{color}}" class="icon iconfont icon-fenxiang"></view>
          <view class="typeName" style="margin-top: -9px; color:{{color}}">分享有礼</view>
        </button> -->
				</view>
				<!-- <view @tap="call" class="item" v-if="null != store.Fservicecall">
                        <view :style="'color:' + color1" class="icon iconfont icon-lianxidianhua"></view>
                        <view class="typeName">联系客服</view>
                    </view> -->
				<!-- <view bindtap="linkPage" data-url="/pages/myStore/myStore" class="item">
        <view style="color:{{color1}}" class="icon iconfont icon-wangdian"></view>
        <view class="typeName">服务网点</view>
      </view> -->
				<!-- <view wx:if="{{ztid!=0}}" bindtap="linkPage" data-url="/pages/selfShop/selfShop" class="item">
        <view style="color:{{color1}}" class="icon iconfont icon-wangdian"></view>
        <view class="typeName">自提点管理</view>
      </view> -->
				<view v-if="Fmodel == 2 && userInfo.Froletype != 1" @tap="linkPage" data-url="/pages/memApply/memApply"
					class="item">
					<view :style="'color:' + color1" class="icon iconfont icon-data-"></view>
					<view :style="'color:' + color1" class="typeName">{{ agent }}</view>
				</view>

			</view>
		</view>
	</view>

	<view class="footer hv-center">加购科技 v2.9.5</view>

	</view>
</template>

<script>
	import sharecircledialog from '@/component/sharecircledialog/sharecircledialog';
	//index.js
	//获取应用实例
	var util = require('../../utils/util.js');
	var api = require('../../utils/prom.js');
	const version = uni.getSystemInfoSync().SDKVersion;
	export default {
		components: {
			sharecircledialog
		},
		data() {
			return {
				color: app.globalData.color,
				color1: '#888',
				agent: '成为代理商',
				userInfo: null,
				canIUse: uni.canIUse('button.open-type.getUserInfo'),

				mebInfo: {
					Fcouponnum: '',
					Fprepaynum: '',
					Fsendnum: '',
					Fconfignum: ''
				},

				isApply: false,
				Fstatus: 0,
				store: null,
				Fmodel: 1,

				Ffx: {
					Frate1: '',
					Frate2: '',
					Fmember1: '',
					Fmember2: ''
				},

				showShare: false,
				isShowShareDialog: false,
				showSharePage: false,
				Fcouponnum: 0,
				sharecircledialog: null,
				hasUserInfo: false
			};
		},
		onReady: function() {
			this.sharecircledialog = this.zpSelectComponent('#sharecircledialog');
		},
		onShow: function() {
			this.onShowClone3389();
		},
		//下拉刷新
		onPullDownRefresh: function() {
			this.onShowClone3389({});
			uni.stopPullDownRefresh();
		},
		//分享
		onShareAppMessage: function(res) {
			return {
				title: app.globalData.shareinfo.title,
				imageUrl: app.globalData.shareinfo.img,
				desc: app.globalData.shareinfo.desc,
				path: 'pages/index/index?Fid=' + uni.getStorageSync('uid')
				//点击分享的图片进到哪一个页面
			};
		},
		methods: {
			onShowClone3389: function() {
				var that = this;
				var userinfo = uni.getStorageSync('user');
				if (null != userinfo.Fnickname) {
					userinfo.Fnickname2 = unescape(userinfo.Fnickname);
				}

				that.userInfo = userinfo;
				that.store = uni.getStorageSync('store');

				if (util.isEmpty(userinfo.Fmobile)) {
					that.Fstatus = 0;
					uni.showModal({
						title: '提示',
						content: '您尚未登录，请先登录',
						showCancel: false,
						confirmText: '登录',

						success(res) {
							that.wxLogin();
						}
					});
				} else {
					that.Fstatus= 1;
					that.memberInfo();
					that.fxinfo();
				}
			},

			doclose: function(e, _dataset) {
				/* ---处理dataset begin--- */
				this.handleDataset(e, _dataset);
				/* ---处理dataset end--- */
				var that = this;
				that.sharecircledialog.hidePopup();
			},
			// //分销数据
			// fxinfo: function() {
			// 	var that = this;
			// 	var userinfo = uni.getStorageSync('user');
			// 	if (that.Fmodel == 2 && userInfo.Froletype != 1) {
			// 		return;
			// 	}
			// 	var param = {
			// 		token: uni.getStorageSync('token')
			// 	};
			// 	api.request('SpFx', 'get', param, function(res) {
			// 		that.Ffx({
			// 			Ffx: res.data
			// 		});
			// 	});
			// },

			//查询会员信息
			// memberInfo: function() {
			// 	var that = this;
			// 	var param = {
			// 		token: uni.getStorageSync('token')
			// 	};
			// 	api.request('SpUserCenter', 'get', param, function(res) {
			// 		var user = res.data.User;
			// 		user.Fnickname2 = unescape(user.Fnickname);
			// 		app.globalData.shareinfo.img = res.data.Fstore.Fsharepic;
			// 		app.globalData.qrUrl = res.data.Fstore.Fsharepic;
			// 		that.setData({
			// 			userInfo: user,
			// 			mebInfo: res.data,
			// 			store: res.data.Fstore,
			// 			Fmodel: res.data.Fstore.Fcxmodel
			// 		});
			// 	});
			// },

			wxLogin: function() {
				uni.navigateTo({
					url: '/pages/userLogin/userLogin'
				});
			},

			linkPage: function(e) {
				var that = this;
				var url = e.currentTarget.dataset.url;
				if (that.Fstatus == 0) {
					that.wxLogin();
					return;
				}
				uni.navigateTo({
					url: url
				});
			}, 
 
			//联系卖家
			call: function() {
				var that = this;
				console.log(that.store.Fservicecall);
				uni.makePhoneCall({
					phoneNumber: that.store.Fservicecall
				});
			},

		 
		}
	};
</script>
<style>
	@import './userCenter.css';
</style>